﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>会员列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="/static/admin/style/adminStyle.css" rel="stylesheet" type="text/css" />
<script src="/static/admin/js/jquery.js"></script>
<script src="/static/admin/js/public.js"></script>
</head>
<body>
 <div class="wrap">
  <div class="page-title">
    <span class="modular fl"><i class="user"></i><em>会员列表</em></span>
    <span class="modular fr"><a href="{{url_for('.add_user')}}" class="pt-link-btn">+添加新会员</a></span>
  </div>
  <div class="operate">
   <form>
    <!--<select class="inline-select">-->
     <!--<option>选择会员等级</option>-->
     <!--<option>白金会员</option>-->
     <!--<option>黄金会员</option>-->
    <!--</select>-->
    <input type="text" class="textBox length-long" id="find" placeholder="输入会员昵称..."/>
    <input type="button" value="查询" class="tdBtn"/>
   </form>
  </div>
  <table class="list-style Interlaced">
   <tr>
     <th>编号</th>
     <th>会员昵称</th>
     <!--<th>邮件地址</th>-->
     <th>手机号码</th>
     <!--<th>是否验证</th>-->
     <!--<th>可用资金</th>-->
     <th>上次登录日期</th>
     <th>注册日期</th>
     <th>操作</th>
   </tr>
   {% for user in users %}
       <tr>
        <td>
         <span class="middle">{{ loop.index }}</span>
        </td>
        <td class="center">{{ user.nick_name }}</td>
        <td class="center">{{ user.mobile }}</td>
        <td class="center">{{ user.last_login }}</td>
        <td class="center">{{ user.create_time }}</td>
        <td class="center">
         <a href="{{url_for('.edit_user')}}" class="inline-block" title="编辑"><img src="/static/admin/images/icon_edit.gif"/></a>
         <a href="{{url_for('.account')}}" class="inline-block" title="资金管理"><img src="/static/admin/images/icon_account.gif"/></a>
         <a class="inline-block" title="删除"><img src="/static/admin/images/icon_drop.gif"/></a>
        </td>
       </tr>
   {% endfor %}
  </table>
 </div>
 <div class="turnPage center fr">

            {% if find %}
                <a href="{{ url_for('.user_list') }}?page=1&find={{ find }}" class="ui-pagination-page-item" >首页</a>
                {% if paginate.has_prev%}
               <a href="{{ url_for('.user_list') }}?page={{ paginate.prev_num }}&find={{ find }}" class="ui-pagination-page-item" >上一页</a>
               {% endif %}
               {% for num in paginate.iter_pages() %}
                   {% if num == paginate.page %}
                    <a href="#">{{ num }}</a>
                   {% elif num %}
                    <a href="{{ url_for('.user_list') }}?page={{ num }}&find={{ find }}">{{ num }}</a>
                   {% endif %}

               {% endfor %}
                {% if paginate.has_next%}
               <a href="{{ url_for('.user_list') }}?page={{ paginate.next_num }};find={{ find }}">下一页</a>
                {% endif %}
               <a href="{{ url_for('.user_list') }}?page={{ paginate.pages }};find={{ find }}">尾页</a>
            {% else %}
                <a href="{{ url_for('.user_list') }}?page=1" class="ui-pagination-page-item" >首页</a>
               {% if paginate.has_prev%}
               <a href="{{ url_for('.user_list') }}?page={{ paginate.prev_num }}" class="ui-pagination-page-item" >上一页</a>
               {% endif %}
               {% for num in paginate.iter_pages() %}
                   {% if num == paginate.page %}
                    <a href="#">{{ num }}</a>
                   {% elif num %}
                    <a href="{{ url_for('.user_list') }}?page={{ num }}">{{ num }}</a>
                   {% endif %}

               {% endfor %}
                {% if paginate.has_next%}
               <a href="{{ url_for('.user_list') }}?page={{ paginate.next_num }}">下一页</a>
                {% endif %}
               <a href="{{ url_for('.user_list') }}?page={{ paginate.pages }}">尾页</a>
            {% endif %}
</div>
<div>
 <script src="/static/index/js/jquery-1.12.4.min.js"></script>
 <script>
  $(".tdBtn").click(function(){
    console.log("asfdasfd");
    var find = $.trim($('#find').val());
    $.ajax({
        url:"/user_list",
        type:"post",
        data:{"find":find},
        success:function(data){
            if(data.code==0){
                location.href = "/user_list?find="+data.msg
            }else{
                alert(data.msg)
            }
        },
    })

});
 </script>
</div>
</body>
</html>